package com.io.controller;

import com.io.dto.ApiResult;
import com.io.entity.SysDeptEntity;
import com.io.exception.SelfException;
import com.io.service.SysDeptService;
import com.io.utils.annotation.SysLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * The class/interface
 *
 * @author guodd
 * @version 1.0 use jdk 1.8
 */
@RestController
@RequestMapping(value = "/api")
public class DemoController {
    @Autowired
    private SysDeptService sysDeptService;

    @SysLog(value = "测试")
    @GetMapping(value = "/demo")
    public ApiResult demo() {
        // 测试
        // 测试
        HashMap<String, Object> par = new HashMap<>();
        List<SysDeptEntity> sysDeptEntities = sysDeptService.queryList(par);
        if (sysDeptEntities.size() > 0) {
            throw new SelfException("开始");
        }
        return ApiResult.ok(sysDeptEntities);
    }
}
